package com.mooc.lib_video

import com.google.gson.JsonObject
import com.mooc.lib_network.entity.BaseEntity
import com.mooc.lib_common.model.HomeFeedEntity
import com.mooc.lib_video.model.CommentsEntity
import com.mooc.lib_video.model.DetailFeedCommentEntity
import com.mooc.lib_video.model.SendCommentEntity
import retrofit2.http.*

interface ApiService {

    @GET("feeds/queryHotFeedsList")
    suspend fun requestHomeList(@Query("feedId")feedId : Int,
                                @Query("feedType")feedType:String,
                                @Query("pageCount")pageCount:Int,
                                @Query("userId")userId:Int):
            BaseEntity<HomeFeedEntity>
    @GET("comment/queryFeedComments")
    suspend fun requestDetailComment(@Query("id")id : Int,
                                     @Query("itemId")itemId:Long,
                                     @Query("pageCount")pageCount:Int,
                                     @Query("userId")userId:Long):
            BaseEntity<DetailFeedCommentEntity>
    //请求参数拼接到url地址当中
    @FormUrlEncoded
    @POST("comment/addComment")
    suspend fun requestSendComments(@Field("commentText")commentText: String,
                                    @Field("height")height: Int,
                                    @Field("image_url")image_url: String,
                                    @Field("itemId")itemId: Long,
                                    @Field("userId")userId: Long,
                                    @Field("video_url")video_url: String,
                                    @Field("width")width: Int
    ):BaseEntity<SendCommentEntity>
    //请求参数封装json字符串->json字符串添加到请求体当中
    //http请求:请求地址(请求方式)
    //请求头:token cookie content-type
    //请求体传递参数
    @POST("comment/addComment")
    suspend fun testSendComment(@Body obj : JsonObject)
}